<!--
  To change this template, choose Tools | Templates
  and open the template in the editor.
-->

<%@ page import="rowingmanager.domain.Organization" contentType="text/html;charset=UTF-8" %>

<html>
  <head>
    <gui:resources components="dataTable"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>List of organizations</title>
    <link rel="stylesheet" href="${createLinkTo(dir:'css',file:'test.css')}" />
  </head>
  <body class="yui-skin-sam">
    <h1>Organizations in the database</h1>
      <gui:dataTable controller="test" action="organizationsAsJSON"  sortedBy="title" columnDefs="[
       [key:'title',label:'Title',sortable:true,resizable:true],
       [key:'phone',label:'Phone',sortable:true,resizable:true],
       [key:'taxid',label:'Tax id',sortable:true,resizable:true],
       [key:'type',label:'Type',sortable:true,resizable:true],
       [key:'street',label:'Street',sortable:false,resizable:true],
       [key:'postalCode',label:'Postal code',sortable:false,resizable:true],

      ]" draggableColumns="true" paginatorConfig="[
      rowsPerPage:'3',
      template:'{PreviousPageLink} {PageLinks} {NextPageLink} {CurrentPageReport}',
      pageReportTemplate:'{totalRecords} total records']"
      rowExpansion="true"/>

   <%-- <table id="org_table">
     <thead>
       <tr>
         <td><!--<g:sortableColumn property="title" title="TITLE"/>-->TITLE</td>
         <td>PHONE</td>
         <td>TAX ID</td>
         <td>TYPE</td>
         <td>STREET</td>
         <td>ZIP</td>
         <td>COUNTRY</td>
         <td>IMAGE</td>
         <td>REMOVE</td>
       </tr>
     </thead>
   <tbody>
     <g:each in="${organizations}" status="i" var="organization">
        <tr class="${(i%2==0)?'even':'odd'}">
          <td>
            <g:link action="showSingle" id="${organization.id}">${fieldValue(bean:organization, field:'title')}</g:link>
          </td>
           <td>
              ${fieldValue(bean:organization, field:'phone')}
           </td>
           <td>
              ${fieldValue(bean:organization, field:'taxid')}
           </td>
           <td>
              ${fieldValue(bean:organization, field:'type')}
           </td>
           <td>
              ${fieldValue(bean:organization.address, field:'street')}
           </td>
            <td>
              ${fieldValue(bean:organization.address, field:'postalCode')}
           </td>
            <td>
              ${fieldValue(bean:organization.address.country, field:'name')}
           </td>
            <td>
              <img class="image" src="${createLink(controller:'test', action:'showAvatar', id:organization.id)}" alt="empty image"/>
           </td>

           <td>
              <g:remoteLink action="delete" id="${organization.id}" update="org_table">delete</g:remoteLink>
           </td>
        </tr>
     </g:each>
     
  </tbody>
 </table>

    <g:paginate controller="test" action="showOrganizations" max="5" total="${Organization.count()}"/>     --%>
  </body>
</html>
